/*
ID: icerupt1
PROG: fence9
LANG: C++11
*/

/* solution
 *
 * Pick's theorem.
 * Area = i + (b/2) -1
 * number i means lattice points in the interior located in the polygon
 * number b means lattice points on the boundary placed on the polygon's perimeter
 *
*/
#include <fstream>
#include <iostream>
#include <cmath>

std::ifstream fin {"fence9.in" };
std::ofstream fout{"fence9.out"};

struct xy { int x; int y; };

int n, m, p;

int gcd(int x, int y)
{
	return ((y == 0) ? x : gcd(y, x % y));
}

auto points_on_edge(xy a, xy b)
{
	return gcd(std::abs(a.x - b.x), std::abs(a.y - b.y)) + 1;
}

int main()
{
	fin >> n >> m >> p;
	double s = p * m / 2.0;
	int poe = p + 1 + points_on_edge({0, 0}, {n, m})
				+ points_on_edge({p, 0}, {n, m}) - 3;
	std::cout << int(s + 1 - (poe/2.0)) << '\n';
	fout << int(s + 1 - (poe/2.0)) << '\n';
}

